package com.test.nnooolwdeaer.dec_wooden.data_wooden

import android.content.Context
import android.util.Log
import com.test.nnooolwdeaer.dec_wooden.util_wooden.StorageUtil_wooden
import com.test.nnooolwdeaer.dec_wooden.util_wooden.gzipString
import com.google.gson.Gson
import org.json.JSONObject

class StorageInfo_wooden(val context: Context) {

    fun fetch(): String? {
        return try {
            val data = hashMapOf<String, Any>().apply {
                put("imei", "")
                put("containSd", StorageUtil_wooden.getContainSD())
                put("ramCanUse", StorageUtil_wooden.getRamCanUse(context))
                put("ramTotal", StorageUtil_wooden.getRamTotal(context))
                put("cashCanUse", StorageUtil_wooden.getCashCanUse())
                put("cashTotal", StorageUtil_wooden.getCashTotal())
                put("extraSD", StorageUtil_wooden.getExtraSD())
                put("internalTotal", StorageUtil_wooden.getTotalInternalStoreSize(context))
                put("internalAvailable", StorageUtil_wooden.getAvailaInternalStoreSize(context))
                put("ramDidUsed", StorageUtil_wooden.getRamDidUsed(context))
                put("cashDidUsed", StorageUtil_wooden.getCashDidUsed())
                put("sdCardTotal", StorageUtil_wooden.getSDCardTotal())
            }
            val dd = Gson().toJson(data).trim()
            Log.d("Stroage---->", "fetch: "+dd)
            dd.gzipString()

        } catch (e: java.lang.Exception) {
            null
        }
    }
}